#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
const int N=1e6+10;
typedef long long ll;
ll a[N];
ll b[N];
vector<ll> v;
ll n,m,k,q;
ll check(ll num)
{
    ll row=1;
    ll col=m;
    ll cnt=0;
    for(row;row<=n;row++)  
    {
        while(col>0 && a[row]*b[col]>num) col--;
        cnt+=col;
    }
    for(int i=0;i<v.size();i++)
    {
        if(v[i]<=num) cnt--;
    }
    return cnt;
}
int main()
{
    cin>>n>>m>>k>>q;
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",a+i);
    }
    for(int i=1;i<=m;i++)
    {
        scanf("%lld",b+i);
    }
    for(int i=0;i<k;i++)
    {
        int aa,bb;
        scanf("%d %d",&aa,&bb);
        v.push_back(a[aa]*b[bb]);
    }
    sort(a+1,a+n+1);
    sort(b+1,b+m+1);
    while(q--)
    {
        ll key;
        cin>>key;
        ll l=a[1]*b[1];
        ll r=a[n]*b[m];
        while(l<r)
        {
            ll mid=r+l>>1;
            if(check(mid)>=key) r=mid;
            else l=mid+1;
        }
        cout<<l<<'\n';
    }
    return 0; 
}
